package com.qf.service;

import com.codingapi.txlcn.tc.annotation.LcnTransaction;
import com.qf.mapper.UserMapper;
import com.sun.prism.shader.Solid_TextureYV12_AlphaTest_Loader;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.client.RestTemplate;

/**
 * @author zhaojian
 */
@Service
public class UserAServiceImpl implements UserAService {

    @Autowired
    private UserMapper userMapper;

    @Autowired
    private RestTemplate restTemplate;


    @Override
    @Transactional
    @LcnTransaction
    public void incrA(Integer id, Integer money) {

        //b账户减钱
        String str = restTemplate.getForObject("http://localhost:8081/decr?id=2&money=500", String.class);
        System.out.println("=========" + str);




        //A账户加钱
        userMapper.incrA(id, money);

        int i = 1/0;




    }

}
